document.addEventListener('DOMContentLoaded', function() {
		    let seats = document.querySelectorAll('.sets input[type="checkbox"]');
		    let totalPriceButton = document.getElementById('totalPriceButton');
		    let seatRecommendationList = document.querySelector('.radio-style'); // 确保这是您要替换的推荐座位列表的类名
		    let maxSeats = 6; // 最多可选座位数
		
		    seats.forEach(seat => {
		        seat.addEventListener('change', function() {
		            if (this.checked && document.querySelectorAll('.sets input[type="checkbox"]:checked').length > maxSeats) {
		                alert('最多只能选择六个座位！');
		                this.checked = false; // 取消当前的选择
		                return; // 早期退出函数
		            }
		            updateSeatSelection();
		            updateTotalPrice();
		        });
		    });
		
		    function updateSeatSelection() {
		        let selectedSeats = document.querySelectorAll('.sets input[type="checkbox"]:checked');
		        let seatDetails = '';
		
		        selectedSeats.forEach(seat => {
		            seatDetails += `<li>座位号: ${seat.id} - 单价: ¥40.9</li>`;
		        });
		
		        if (selectedSeats.length > 0) {
		            seatRecommendationList.innerHTML = seatDetails;
		        } else {
		            seatRecommendationList.innerHTML = '<li style="background-color: white; margin-left: 20px;"><span style="background-color: white;">推荐座位</span></li>';
		        }
		    }
		
		    function updateTotalPrice() {
		        let selectedSeats = document.querySelectorAll('.sets input[type="checkbox"]:checked');
		        let totalPrice = 0;
		        selectedSeats.forEach(() => {
		            totalPrice += 40.9;
		        });
		        totalPriceButton.innerHTML = `总价: ¥${totalPrice.toFixed(2)} 确认选座`;
		    }
		});